using System;
using System.Web;

namespace GoogleScriptInjector
{
	public class RequestProcessor : IHttpModule
	{
		public void Init(HttpApplication app)
		{
			app.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute);
		}

		public void OnPreRequestHandlerExecute(object sender, EventArgs args)
		{
			//get application
			HttpApplication app = (HttpApplication)sender;

			//set filter
			app.Response.Filter = new ScriptInjector(app.Response.Filter);
		}

		public void Dispose() {}
	}
}
